package com.shujia.wyh.day13;

public class ThreadGroupDemo {
    public static void main(String[] args) {
        ThreadGroup tg1 = new ThreadGroup("帅哥组");
        ThreadGroup tg2 = new ThreadGroup("美女组");

        //Thread(ThreadGroup group, String name)
        //分配一个新的 Thread对象。
        StudentThread st1 = new StudentThread(tg1, "吴涛");
        StudentThread st2 = new StudentThread(tg1, "陈涛");
        System.out.println(st1.getName()+"---"+st1.getThreadGroup().getName());
        System.out.println(st2.getName()+"---"+st2.getThreadGroup().getName());


        StudentThread st3 = new StudentThread(tg2, "宋玉");
        StudentThread st4 = new StudentThread(tg2, "张园园");
        System.out.println(st3.getName()+"---"+st3.getThreadGroup().getName());
        System.out.println(st4.getName()+"---"+st4.getThreadGroup().getName());

        //将帅哥组设置成后台线程
        tg1.setDaemon(true);


    }
}
